package com.qch.rabbitmq.demo;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;


/**
 * @Author qch
 * @Date 2021/5/14
 */
@Component
public class MyMessageListener {
   /* @RabbitListener(queues = "queue.ano")
    public void  whenMessageCome(Message message) throws UnsupportedEncodingException {
        System.out.println(new String(message.getBody(),message.getMessageProperties().getContentEncoding()));

    }*/
  /* @RabbitListener(queues = "queue.ano")
   public void  whenMessageCome(@Payload String messageStr){
       System.out.println(messageStr);

   }*/
   @RabbitListener(queues = "queue.ano")
   public void whenMessageCome(@Payload String messageStr) {
       System.out.println(messageStr);
   }
}
